BlockingCollection(T) Constructor (IProducerConsumerCollection(T), Int32)

Task Parallel System.Threading

Initializes a new instance of the BlockingCollection<(Of <(T>)>) class with the specified upper-bound and using the provided IProducerConsumerCollection<(Of <(T>)>) as its underlying data store.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	collection As IProducerConsumerCollection(Of T), _
	boundedCapacity As Integer _
)
C#
public BlockingCollection(
	IProducerConsumerCollection<T> collection,
	int boundedCapacity
)

Parameters

collection
Type: System.Collections.Concurrent..::.IProducerConsumerCollection<(Of <(T>)>)
The collection to use as the underlying data store.
boundedCapacity
Type: System..::.Int32
The bounded size of the collection.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThe collection argument is null.
System..::.ArgumentOutOfRangeExceptionThe boundedCapacity is not a positive value.
System..::.ArgumentExceptionThe supplied collection contains more values than is permitted by boundedCapacity.

See Also